package Java攻略._3_流式操作._1_流的创建;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class _4_利用Stream_iterate方法创建流 {

    public static void main(String[] args) {

        List<BigDecimal> nums = Stream.iterate(BigDecimal.ONE, n -> n.add(BigDecimal.ONE))
                .limit(11)
                .collect(Collectors.toList());

        System.out.println(nums);


        Stream.iterate(LocalDate.now(), ld -> ld.plusDays(1L))
                .limit(5)
                .forEach(System.out::println);
    }
}
